import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../res/style.dart';

class TextBtn extends StatelessWidget {
  final String title;
  final double widget;
  final double height;
  final double radius;
  final double fontSize;
  Function()? onTap;
  Color bgColor;

  TextBtn(
      {Key? key,
      required this.title,
      this.onTap,
      this.bgColor = Colors.red,
      this.widget = 270,
      this.height = 40,
      this.fontSize = 16,
      this.radius = 8})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (onTap != null) {
          onTap!();
        }
      },
      child: Container(
        alignment: Alignment.center,
        width: widget.w,
        height: height.h,
        decoration: BoxDecoration(
          color: bgColor,
          borderRadius:  BorderRadius.all(Radius.circular(radius)),
        ),
        child: Text(
          title,
          style: TextStyle(color: Colors.white, fontSize: fontSize.sp),
        ),
      ),
    );
  }
}
